package com.simga.library.http;

import com.simga.library.utils.LogUtil;

/**
 * Created by Eric on 2017/2/8.
 * <p>
 * Describe:服务端返回异常类
 */

public class APIException extends RuntimeException {
    private String code;
    private String displayMessage;

    public APIException(String code, String displayMessage) {
        this.code = code;
        this.displayMessage = displayMessage;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDisplayMessage() {
        return displayMessage;
    }

    public void setDisplayMessage(String displayMessage) {
        this.displayMessage = displayMessage;
    }

    /**
     * 判断是否是token失效
     *
     * @return 失效返回true, 否则返回false;
     */
    public boolean isLoginExpired() {
        return code.equals("5000102");
    }
}